import request, {
  Method,
  buyerUrl,
  commonUrl,
  managerUrl,
  sellerUrl,
  expertUrl,
} from "@/plugins/request.js";
import axios from "axios";
// ************************** 我的关注***********************************
// 专家列表
export function getExpertsList(data) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/user/findIdol`,
    method: Method.POST,
    needToken: true,
    data,
  });
}

// 取消关注
export function cancleAttention(params) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/user/idol`,
    method: Method.DELETE,
    needToken: true,
    params,
  });
}

// ************************** 我的课程***********************************
// 课程列表
export function getCourseList(data) {
  return request({
    url: `${buyerUrl}/buyer/user/userCourse/myList`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// ***********************我的预约详情*************************

// 预约详情
export function getAppointId(id) {
  return request({
    url: `${buyerUrl}/buyer/user/userRegister/${id}`,
    method: Method.GET,
    needToken: true,
  });
}

// 取消预约
export function cancleAppoint(id) {
  return request({
    url: `${buyerUrl}/buyer/user/userRegister/cancel/${id}`,
    method: Method.PUT,
    needToken: true,
  });
}

// 处方列表
export function getPrescripList(id) {
  return request({
    url: `${buyerUrl}/buyer/user/userRegister/prescriptionDetails/${id}`,
    method: Method.GET,
    needToken: true,
  });
}

// 找专家患者评价列表
export function getEvaluatelist(data) {
  return request({
    url: `${expertUrl}/expert/expert/expert/getExpertEvaluate`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// 处方下载
export function downFile(data) {
  return request({
    url: `${commonUrl}/common/common/download`,
    method: Method.POST,
    needToken: true,
    responseType: "blob",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    data,
  });
}

// 处方下载

export function postExport(data) {
  let accessToken = localStorage.getItem("accessToken");
  return axios({
    method: "post",
    url: `${commonUrl}/common/common/download`,
    data,
    headers: {
      accessToken: accessToken,
      "Content-Type": "multipart/form-data",
    },
    responseType: "blob",
  });
}

// 找场地列表
export function getSiteAll(id) {
  return request({
    url: `${expertUrl}/expert/site/site/byExpertId/${id}`,
    method: Method.GET,
    needToken: true,
  });
}
